#ifndef RAYTRACER_H
#define RAYTRACER_H

#include <QWidget>
#include <QPainter>
#include <QTimer>
#include <QFuture>
#include <QFutureWatcher>

#include <qrgb.h>
#include "vector.h"
#include "ray.h"
#include "sphere.h"
#include "box.h"
#include "camera.h"
#include "renderer.h"
#include "scene.h"
#include "sphere.h"
#include <iostream>
#ifndef Q_MOC_RUN
#include <boost/random.hpp>
#include <boost/format.hpp>
#endif

class RayTracer : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(int depth READ depth WRITE setDepth)
    Q_PROPERTY(int samples READ samples WRITE setSamples)

    QImage* _image;
    Camera* _camera;
    Scene* _scene;
    Renderer* _renderer;

    int _depth;
    int _samples;
    double _luminosity;
    double _gamma;

public:
    explicit RayTracer(Scene* scene, QWidget *parent = 0);

    void render();
    void update();

    int depth() const;
    int samples() const;
    double luminosity() const;
    double gamma() const;

    void setGamma(double value);
    void setLuminosity(double value);
    void setDepth(int value);
    void setSamples(int value);

    void paintEvent(QPaintEvent *e);
    Renderer* renderer();

    
signals:
    
public slots:
    void sampleComputed(int value);
    void endScene();
};

#endif // RAYTRACER_H
